package qnb._config;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.lang.Nullable;
import org.springframework.web.servlet.HandlerInterceptor;

public class AdminHandlerInterceptor implements HandlerInterceptor {
	
	/**
	 * 前
	 */
	@Override
	//url-.....->此方法->Controller
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		System.out.println("我是拦截器preHandle方法");
		String a=request.getParameter("a");
		if(null!=a) {
			response.sendRedirect("https://www.weixinkeji.vip");
			return false;
		}else {
			return true;
		}
		
	}
	//url-.....->preHandle（拦截器前方法）->Controller->此方法
	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
			@Nullable Exception ex) throws Exception {
		System.out.println("我是拦截器afterCompletion方法");
	}
}
